<?php
    include_once("./service/articleService.php");
?>
<div class="navigator-wrapper">
    <ul class="navigator">
        <li class="active"><a href="index.php"><div></div>TRANG CHỦ</a><span>|</span></li>
		<!--
        <li><a href="#">HƯỚNG DẪN MUA HÀNG</a><span>|</span></li>
        <li><a href="#">CÁC THƯƠNG HIỆU</a><span>|</span></li>
		-->
        <?php
            $pages = getAllPage();
			$row = mysql_num_rows($pages) - 1;
            $count = 0;
            
            while($page = mysql_fetch_array($pages)){
                if($count == $row){
        ?>
            	   <li><a href="./news.php?page=<?php echo $page["PAG_ID"]; ?>"><?php echo $page["PAG_NAME"]; ?></a></li>    
        <?php
                } else {
        ?>
                    <li><a href="./news.php?page=<?php echo $page["PAG_ID"]; ?>"><?php echo $page["PAG_NAME"]; ?></a><span>|</span></li>
        <?php            
                }
                $count++;
            }
        ?>
    </ul>
    <div class="user-action">
    	<?php
			if(!isset($_SESSION["username"])){
        ?>
            <ul>
                <li><a href="register.php">Đăng nhập</a><span>&#32;|</span></li>
                <li><a href="register.php">Đăng ký</a></li>
            </ul>
        <?php
			} else {
        ?>
        <div class="authenticated-wrapper">
        	<div class="authenticated">
				<div class="hello-block">
                	<span>Chào,</span>&#32;<span><?php echo $_SESSION["username"][1];?></span>                
                </div>
                <div class="cart-profile-menu-wrapper">
                    <span>Chào,</span>&#32;<span><?php echo $_SESSION["username"][1];?></span>
                    <a href="profile-cart.php#profile-tab"><span>Thông tin cá nhân</span></a>
                    <a href="profile-cart.php#cart-tab"><span>Giỏ hàng của tôi</span></a>
                    <hr/>
                    <a href="action/logoutClientAction.php"><span>Thoát</span></a>
                </div>
            </div>
        </div>
        <?php 
			}
		?>
    </div>
</div>
<script>
    userid = <?php echo isset($_SESSION["userid"])?$_SESSION["userid"]:"0"; ?>; 
</script>